<?php
session_start();
if (!$_SESSION["autentificado"]) {
    header('Location: index.php');
}
?>
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
  <title>Registro</title>
  <meta name="HandheldFriendly" content="True" />
  <meta name="MobileOptimized" content="320" />
  <meta content="minimum-scale=1.0, width=device-width, maximum-scale=1.0, user-scalable=no" name="viewport" />
  <meta name="description" content="">
  <script type="text/javascript" src="js/ajax.js"></script>
  <link  href="http://fonts.googleapis.com/css?family=Oswald:regular" rel="stylesheet" type="text/css" >
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  <link rel="stylesheet" href="css/style.css">
  <link rel="stylesheet" href="fonts/raphaelicons.css">
  <link rel="stylesheet" href="css/main2.css">
  <link rel="stylesheet" type="text/css" href="css/inicio.css">

  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
  <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
  <script type="text/javascript" src="https://raw.github.com/HPNeo/gmaps/master/gmaps.js"></script>   
  <script type="text/javascript" src="http://hpneo.github.com/gmaps/prettify/prettify.js"></script>
<script>
  function recuperar(){
    document.getElementById('select1').load
  }
   </script>
  <script type="text/javascript">

   $(document).ready(function(){
      prettyPrint();
      map = new GMaps({
        div: '#map',
        lat: -12.043333,
        lng: -77.028333
      });
      $('#geocoding_form').submit(function(e){
        e.preventDefault();
        var ciud = $('#listaprovincias option:selected').text();
        var local = $('#lugar2').val().trim();
        var concat = local+' '+ciud;
        document.getElementById('lugar').value=concat;
        var priv = $('#privados option:selected').text();
        document.getElementById('privado').value=priv;
        GMaps.geocode({
          address: concat,
          callback: function(results, status){
            if(status=='OK'){
              var latlng = results[0].geometry.location;
              map.setCenter(latlng.lat(), latlng.lng());
              map.addMarker({
                lat: latlng.lat(),
                lng: latlng.lng()
              });
            }
          }
        });
      });
    });
  </script>
</head>

<!--[if lt IE 7]> <body class="ie6 oldies"> <![endif]-->
<!--[if IE 7]>    <body class="ie7 oldies"> <![endif]-->
<!--[if IE 8]>    <body class="ie8 oldies"> <![endif]-->
<!--[if gt IE 8]><!-->
<body><!--<![endif]-->

<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
  <header class="clearfix">
      <div class="container">       
        <nav class="clearfix">
          <ul role="navigation">
            <li>
              <a href="index.php"><span class="icon"></span>Inicio</a>
            </li>
            <li>
              <a href="inicio.php"><span class="icon"></span>Ciudades</a>
            </li>
            <li>
              <a href="registrarcita.php"><span class="icon"></span>Tu Reunion</a>
            </li>
            <li>
              <a href="salir.php"><span class="icon"></span>Salir</a>
            </li>
          </ul>
        </nav>
      </div>
  </header>
   <section role="banner">
       <article role="main" class="clearfix">
           <div class="post">
            <figure>
            <img src="images/logo.png" alt="logo">
          </figure>       
           </div>
       </article>
   </section> <!-- // banner ends -->
   <section class="container">
       <div class="columns">

           <article>
              <section id="contenedor_contacto">
                <h2>Ubicación</h2>
                <label for="region">Región:</label>
                   <?php
                     include_once("php/localidades.php");
                    ?>
                <label for="ciudad">Ciudad:</label>
                   <select id='listaprovincias' name='select2' onFocus='recuperar()'>
                      <option value="11">Iquique</option>
                      <option value="14">Tamarugal</option>
                    </select>
                    <form method="post" id="geocoding_form">
                            <label for="address">Dirección:</label>
                            <div class="input">
                              <input type="text" placeholder="lugar" id="lugar2" name="address" />
                              <input type="submit" class="btn" value="Buscar" />
                              <div id="map"></div>
                            </div>
                          </form>
              </section>
              <!--aca van las citas -->

           </article>
       </div> <!-- //.columns -->
       <section id="datoreunion">
        <h2>Datos de la Reunión</h2>
        
          <form method="post" action="php/regcita.php">
            <input type="text" placeholder="titulo de la cita" name="titulo" id="titulo">
            <input type="date" placeholder="fecha" name="fecha" id="fecha">
            <input type="time" placeholder="hora" name="hora" id="hora">
            <input type="hidden" placeholder="lugar" name="lugar" value="<?php echo $co; ?>" id="lugar" >
            <input type="hidden" placeholder="lugar" name="privado" id="privado" >
            
                               
            <select  id="privados">
              <option value="Privado">Privado</option>
              <option value="Publico">Publico</option>
            </select>
            <textarea type="text" placeholder="tematica" name="tematica" id="tematica" rows="6"></textarea>
             <input type="hidden" id="formidprovincia" name="formidprovincia" value="11">
            <input type="submit" value="aceptar">
          </form>  
          
       </section>
       
          
               
    </section>
  <footer role="contentinfo">
          <p>2012 Inacap Temuco. All rights reserved.</p>
          <p>Taller de Desarrollo Web</p>
          <ul class="social-icons">
          <li><a href="http://www.facebook.com/" class="icon flip">^</a></li>
          <li><a href="" class="icon">T</a></li>
          <li><a href="http://www.twitter.com/" class="icon">^</a></li>
        </ul>
  </footer>

<script type="text/javascript">

$('#select1').change(function(){
    var selectedOption = $(this).find('option:selected');
    var selectedLabel = selectedOption.text();
    var selectedValue = selectedOption.val();

    $("#formidprovincia").val($("#listaprovincias").find('option:selected'));
    mostrarProvincias(selectedValue); 
  });
$('#listaprovincias').change(function(){
    var selectedOption = $(this).find('option:selected');
    var selectedLabel = selectedOption.text();
    var selectedValue = selectedOption.val();
    $("#formidprovincia").val(selectedValue);
    //mostrarCitas(selectedValue);
  });
</script>
</body>
</html>